$(document).ready(function() {	
	$("#frmUpload").validate({
		errorClass		: 'error',
		errorElement	: 'span',
		onfocusout		: false,
		onkeyup			: false,
		ignore			: 'input[type="text"]:hidden',
		rules: {	
			palbumid: {
				min						: 1
			},
			pal_name:{
				required				: true,
				minlength				: VL_NAME_MINLENGTH
			},
			pimage: {		
				required				: true,
				validateImgFormat		: true,
				validateImgSize			: true
			},			
			pname:{				
				minlength				: VL_NAME_MINLENGTH
			}
		},
		messages: {		
			palbumid: {
				min						: album_required
			},
			pal_name:{
				required				: album_name_required,
				minlength				: album_name_minlength
			},		
			pimage: {
				required				: image_required,
				validateImgFormat		: image_format,
				validateImgSize			: image_size
			},			
			pname:{				
				minlength				: image_name_minlength
			}
		},
		errorPlacement: function(label, element) {
			var id = element.attr('id');	
			label.insertAfter($('#' + id));			
		}				 
	});
	$.validator.addMethod('validateImgFormat', function() {
		var strLinkImage = $('#pimage').val();
		if(strLinkImage == "") {
			return true;
		}
		return validateImage(strLinkImage);
	});
	$.validator.addMethod('validateImgSize', function() {
		var strLinkImage = $('#pimage').val();
		if(strLinkImage == "") {
			return true;
		}
		return validateImgSize('pimage');
	});				
});
deleteImg = function(intId, intAlbumId, intType) {
	if(confirm(confirm_delete_img) == true) {
		document.location.href = HOST_BACKEND + 'slideshow/delimg?imgid=' + intId + '&albumid=' + intAlbumId + '&type=' + intType;
	} 
	return false;
}